package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionFormDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.po.InteractionQuestion;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionQuestionService;
import com.tianji.learning.service.IInteractionReplyService;
import com.tianji.learning.service.impl.InteractionQuestionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author mytjxt
 * @since 2024-05-27
 */
@Api(tags = "互动回复相关接口")
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
@Slf4j
public class InteractionReplyController {
    private final IInteractionReplyService interactionReplyService;

    /**
     * 新增评论或回答
     */
    @ApiOperation("新增回答或评论")
    @PostMapping
    public void addReply(@RequestBody ReplyDTO replyDTO){
        interactionReplyService.addReply(replyDTO);
    }

    @ApiOperation("分页查询回答或评论")
    @GetMapping("page")
    public PageDTO<ReplyVO> queryReplyPage(ReplyPageQuery pageQuery){
        return interactionReplyService.queryReplyPage(pageQuery, false);
    }

}
